/**  
 * All rights Reserved, Designed By www.flksh.com
 * @date:   2017-11-04 14:54:28   
 * @Copyright: 2013-2017 www.flksh.com Inc. All rights reserved. 
 * 注意：本内容仅限于上海福乐康社区养老服务有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
package com.zx.cloud.controller;

import io.swagger.annotations.ApiOperation;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.RequestLogging;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.model.response.Response;
import com.zx.cloud.service.LogService;
import com.zx.cloud.util.Page;
import com.zx.cloud.common.filter.CurrentUserId;
import com.zx.cloud.domain.Log;


/**
 * 系统日志
 */
@RestController
@RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/log")
public class LogController{

	private static final Logger logger=Logger.getLogger(LogController.class);
	
	@Autowired
	private LogService logService;
	
	@RequestLogging
	@ApiOperation(value = "查询日志" , notes="查询日志")
	@RequestMapping(value = "queryLog", method = RequestMethod.POST)
	@ResponseBody
	public Response queryLog(@CurrentUserId Long userId,@RequestBody Log log){
		logService.addLog(userId, "查询日志", 0);
		log.setOrderBy("createTime desc");
		Page<Log> datas=logService.Logpage(log);
		return new ObjectDataResponse<Page<Log>>(datas);
	}
}
